package com.arcsoft.api.system.controller;


import com.arcsoft.api.base.util.ResponseResult;
import com.arcsoft.api.system.dto.RecognitionFaceRequest;
import com.arcsoft.api.system.dto.RegisterFaceRequest;
import com.arcsoft.api.system.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/user")
@CrossOrigin
public class UserController {
    @Resource
    IUserService userService;

    @PostMapping("/register")
    public ResponseResult register(@RequestBody RegisterFaceRequest request) {
        userService.registerFace(request);
        return ResponseResult.success();
    }

    @PostMapping("/recognition")
    public ResponseResult recognition(@RequestBody RecognitionFaceRequest request) {
        return ResponseResult.success(userService.recognition(request));
    }

    @PostMapping("/attribute")
    public ResponseResult attribute(@RequestBody RecognitionFaceRequest request) {
        return ResponseResult.success(userService.attribute(request));
    }

}
